<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: last_orders.php 11 2013-09-21 11:43:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 11 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:43:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

$orders = $db->db_query_limit("SELECT
									orders_id,
									DATE_FORMAT(date_purchased, '%d.%m.%Y %H:%m') AS date_purchased,
									delivery_name
								FROM
									".TABLE_ORDERS."
								ORDER BY
									orders_id DESC", 15, true);
?>
<table width="100%" class="dataTable">
	<tr>
		<td width="1px"><b>Best-Nr</b></td>
		<td><b>Name</b></td>
		<td><b>Best-Datum</b></td>
		<td align="right"><b>Preis</b></td>
	</tr>
	<?php
		if($orders->_numOfRows > 0) {
			while(!$orders->EOF) { $rows++;
				$price = $db->db_query("SELECT text FROM ".TABLE_ORDERS_TOTAL." WHERE orders_id = '".$orders->fields['orders_id']."' AND class = 'ot_total'", true);
				if ($rows % 2 == 0)
		    		$f = 'dataTableRow';
		    	else
		    		$f = '';
			?>
				<tr class="<?php echo $f ?>" onclick="document.location.href='<?php echo href_link('orders.php', 'oID='.$orders->fields['orders_id'].'&action=edit&'.getMenuID('orders')) ?>'" onmouseover="this.className='dataTableRowOver';this.style.cursor='pointer'" onmouseout="this.className='<?php echo $f ?>'">
					<td><?php echo $orders->fields['orders_id'] ?></td>
					<td><?php echo $orders->fields['delivery_name'] ?></td>
					<td><?php echo $orders->fields['date_purchased']; ?></td>
					<td align="right"><nobr><?php echo $price->fields['text']; ?></nobr></td>
				</tr>
			<?php
				$orders->MoveNext();
			}
		} else
			echo '<tr><td colspan="4" align="center"><em>noch keine Bestellung vorhanden</em></td></tr>';
	?>
</table>